package cn.chencaiju.blog.domain;

import java.util.Date;

import com.alibaba.fastjson.annotation.JSONField;

public class Post {
	private Integer id;

	private String title;
	private String content;
	
	@JSONField(format = "yyyy-MM-dd HH:mm:ss")
	private Date 	created;
	private Category category;
	
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}

	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public Date getCreated() {
		return created;
	}
	public void setCreated(Date created) {
		this.created = created;
	}
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Post [id=");
		builder.append(id);
		builder.append(", 标题=");
		builder.append(title);
		builder.append(", 内容=");
		builder.append(content);
		builder.append(", 创建时间=");
		builder.append(created);
		builder.append(",分类=");
		if(getCategory()!=null) {
			builder.append(getCategory().getName());			
		}else {
			builder.append("null");
		}
		builder.append(",cid=");
		builder.append(category.getId());
		builder.append("]");
		return builder.toString();
	}
	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	
}
